Skip to content

[FeatureBranch/DoNotReview][Chrome Next] Keep all AI buttons #260937

Merged
Dosant merged 2 commits intoelastic:feature/chrome-nextfrom
Dosant:feature/chrome-next-ai-button
Apr 2, 2026
Merged

[FeatureBranch/DoNotReview][Chrome Next] Keep all AI buttons #260937
Dosant merged 2 commits intoelastic:feature/chrome-nextfrom
Dosant:feature/chrome-next-ai-button

Conversation

@Dosant
Copy link
Copy Markdown
Contributor

@Dosant Dosant commented Apr 2, 2026

Summary

Fixes the AI assistant buttons not appearing in the Chrome Next header.

Relates to #260010

Problem

Chrome Next renders the header differently from the legacy chrome — it does not render HeaderNavControls (the chrome.navControls.registerRight mount points). All AI assistant buttons (Security, Observability, Search, AI experience picker) relied exclusively on registerRight, so they were invisible when Chrome Next was enabled.

Additionally, the existing chrome.next.aiButton.set() API was a single-slot, last-write-wins design — only the Agent Builder could use it, and other AI experiences had no way to register their buttons.

Changes

1. Multi-registration aiButton.register() API

Replaced chrome.next.aiButton.set(node) with chrome.next.aiButton.register(button):

  • Multiple plugins can register buttons; each call returns an unregister callback
  • Accepts ReactNode | MountPoint as content (via ChromeExtensionContent), so plugins can reuse their existing mount functions
  • Internal state uses BehaviorSubject<ReadonlySet<ChromeNextAiButton>> to manage registrations
  • Chrome Next header renders all registered buttons via AiButtonSlot

2. Dual registration in all AI plugins

Each AI plugin now registers with both chrome.navControls.registerRight (legacy) and chrome.next.aiButton.register (Chrome Next). This ensures buttons appear regardless of which chrome is active. All dual registrations are marked with // TODO: Chrome-Next hack comments linking to #260010 for cleanup once Chrome Next is the only chrome.

Plugins updated:

  • elastic_assistant (Security AI Assistant)
  • observability_ai_assistant_app (Observability AI Assistant)
  • search_assistant (Search AI Assistant)
  • ai_assistant_management/selection (AI experience picker)
  • agent_builder (Agent Builder — already had Chrome Next registration, updated to new API)

3. Type consolidation

Moved all Chrome Next types into src/core/packages/chrome/browser/src/chrome_next/:

  • ChromeNextAiButton, ChromeNextHeaderConfig, ChromeNextGlobalSearchConfig, ChromeNext
  • Extracted InternalChromeNext interface in browser-internal-types

4. Empty mount point layout fix

Fixed phantom gaps in the Chrome Next trailing actions caused by AI buttons that register but render nothing (e.g., when a solution's assistant is not enabled). Applied mountPointContainerCss to both the MountPoint and ReactNode branches in HeaderExtension so empty wrappers collapse out of the flex layout.

@elasticmachine
Copy link
Copy Markdown
Contributor

🤖 Jobs for this PR can be triggered through checkboxes. 🚧

ℹ️ To trigger the CI, please tick the checkbox below 👇

  • Click to trigger kibana-pull-request for this PR!
  • Click to trigger kibana-deploy-project-from-pr for this PR!
  • Click to trigger kibana-deploy-cloud-from-pr for this PR!
  • Click to trigger kibana-entity-store-performance-from-pr for this PR!
  • Click to trigger kibana-storybooks-from-pr for this PR!

Copy link
Copy Markdown
Member

@kowalczyk-krzysztof kowalczyk-krzysztof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

set(config?: ChromeNextGlobalSearchConfig): void;
};
};
/** {@inheritdoc ChromeNext} */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL about @inheritdoc. I've been copy pasting docs everywhere

order: 1001,
});

// TODO: Chrome-Next hack — dual registration needed because Chrome Next doesn't render
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is what it is...

@Dosant Dosant marked this pull request as ready for review April 2, 2026 15:25
@Dosant Dosant requested review from a team as code owners April 2, 2026 15:25
@Dosant Dosant merged commit bc6afc7 into elastic:feature/chrome-next Apr 2, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants